//package com.douqu.game.main.platform;
//
//import com.alibaba.fastjson.JSONObject;
//import com.bean.core.util.HttpStringUtil;
//import com.douqu.game.core.database.model.UserModel;
//import com.douqu.game.core.factory.PlatformFactory;
//import com.douqu.game.core.protobuf.SGCommonProto;
//import com.douqu.game.core.util.CoreUtils;
//import com.douqu.game.core.util.LogUtils;
//import com.douqu.game.main.service.PlayerService;
//import com.douqu.game.core.util.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import java.text.MessageFormat;
//
///**
// * Created by Administrator on 2018/9/7 0007.
// */
//@Component
//public class QWImpl implements PlatformSDK{
//
//    @Autowired
//    private PlayerService playerService;
//
//    @Override
//    public UserModel login(String account, String password) {
//        LogUtils.info("抢玩登录参数:" + account + "  " + password);
//        String url = MessageFormat.format(PlatformFactory.QW_CHECK_LOGIN_URL, account, password);
//        LogUtils.info("抢玩url:" + url );
//        String str = HttpStringUtil.sendHttpGet(url);
//        LogUtils.info("抢玩str:" + str );
//        JSONObject result = JSONObject.parseObject(str);
//        int status;
//        String msg;
//        try {
//            status =  result.getInteger("status");
//            msg = result.getString("msg");
//            LogUtils.info("抢玩返回值:" + status + "  " + msg);
//        }catch (Exception e){
//            LogUtils.error("WQ获取数据失败:" + account);
//            e.printStackTrace();
//            return new UserModel();
//        }
//        if( StringUtils.isNullOrEmpty(msg))
//        {
//            LogUtils.error("WQ获取数据失败:" + account);
//            return new UserModel();
//        }
//        if(status == 0||msg.equals("failed")){
//            LogUtils.error("WQ验证失败:" + account);
//            return new UserModel();
//        }
//        account = CoreUtils.createAccount(account, SGCommonProto.E_CHANNEL_TYPE.CHANNEL_TYPE_QIANGWAN);
//        UserModel player = playerService.getUserByAccount(account);
//
//        return player;
//    }
//}
